package com.zbkj.crmeb.chant.controller;

import com.common.CommonPage;
import com.crmeb.core.common.CommonResult;
import com.zbkj.crmeb.chant.request.ChannelMerchantExperienceRequest;
import com.zbkj.crmeb.chant.response.ChannelMerchantExperienceResponse;
import com.zbkj.crmeb.chant.service.ChannelMerchantExperienceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/admin/channel/merchant/experience")
@Api(tags = "体验商户")
public class ChannelMerchantExperienceController {

    @Autowired
    private ChannelMerchantExperienceService channelMerchantExperienceService;

    @ApiOperation(value = "查询体验商户列表")
    @GetMapping(value = "/list")
    public CommonResult<CommonPage<ChannelMerchantExperienceResponse>> getList(ChannelMerchantExperienceRequest request) {
        return CommonResult.success(channelMerchantExperienceService.getList(request));
    }

    @ApiOperation(value = "变更类型")
    @PutMapping(value = "/change/{merId}/{productType}")
    public CommonResult<Boolean> changeExperienceType(@ApiParam(value = "需要变更的体验商户的商户id") @PathVariable("merId") Integer merId,
                                                      @ApiParam(value = "需要变更的类型") @PathVariable("productType") Integer productType) {
        return CommonResult.success(channelMerchantExperienceService.changeExperienceType(merId, productType, false));
    }

}
